<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Server-side Extension</title>
    </h:head>
    <h:body>
        <h1>Server-side Extension</h1>
        <h2>f:validateLength and f:convertNumber</h2>
        Enter 1 to 3 characters, integer only, everything else triggers validation
        <h:form>
            Enter a number: <h:inputText value="#{user.age}" id="age">
                <f:validateLength minimum="1" maximum="3" for="age"/>
                <f:convertNumber integerOnly="true" for="age"/>
            </h:inputText>
            <h:commandButton value="Submit"/>
        </h:form>

        <h2>Custom Converter</h2>
        Converts the entered characters to number
        <h:form>
            Enter a number: <h:inputText value="#{userAge}" id="age">
                <f:converter converterId="myConverter"/>
            </h:inputText>
            <h:commandButton value="Submit" action="converter"/>
        </h:form>

        <h2>Custom Validator</h2>
        Enter &lt; 3 characters to trigger validation
        <h:form>
            <h:inputText value="#{user.name}" id="name">
                <f:validator validatorId="nameValidator"/>
            </h:inputText>
            <h:commandButton value="Submit"/>
        </h:form>
    </h:body>
</html>

